<template>
  <view>
    <view class="records-main">
      <view v-for="(item, index) in DiseaseOrderList" :key="index">
        <view class="flexrow flexbetween records-title">
          <view>
            <span class="marginr6">{{ item.patientName || "-" }}</span>
            <span class="color999 fontsize14 marginr6">{{
              gendertosex(item.patientGender)
            }}</span>
            <span class="color999 fontsize14 marginr6">|</span>
            <span class="color999 fontsize14 marginr6">{{ item.patientAge || "0" }}岁</span>
          </view>
          <view class="colorC73" v-if="DiseaseOrderquery.category == 1">在线问诊</view>
          <view class="colorC73" v-if="DiseaseOrderquery.category == 2">上门治疗</view>
        </view>
        <view class="records-con">
          <view>
            <view class="color999" style="width: 350rpx">病情描述</view>
            <view>{{ item.depict || "" }}</view>
          </view>
          <view>
            <view class="color999">患病时长</view>
            <view>{{ item.duration || "" }}</view>
          </view>
          <view>
            <view class="color999">医院检查</view>
            <view>{{ item.examine || "" }}</view>
          </view>
          <view>
            <view class="color999">用药情况</view>
            <view>{{ item.medication || "" }}</view>
          </view>
        </view>
        <view class="fontsize14 flexrow flexbetween recordbot">
          <view>接诊医生</view>
          <view v-if="item.state > 1">{{ item.name || "" }}</view>
          <view v-else>
            <template v-if="item.state == 0">未支付</template>
            <template v-if="item.state == 1">
              <view @click="noreceive(item.orderNumber)">未接诊</view>
            </template>
          </view>
        </view>
        <view class="line" v-if="DiseaseOrderList.length - 1 != index"></view>
      </view>
      <lack v-if="DiseaseOrderList.length == 0"></lack>
      <u-loadmore :status="status" v-if="DiseaseOrderList.length > 0 && blackFlage" style="padding-bottom: 40rpx" />
    </view>
  </view>
</template>

<script>
import { getDiseaseOrderList } from '../../api/index.js'
import Lack from "@/chronicDisease/components/lack/lack.vue";

export default {

  components: {
    Lack
  }, data() {
    return {
      DiseaseOrderquery: {
        pageNumber: 1,//	必选	Integer	页数
        pageSize: 10,//	必选	Integer	每页显示的数量
        category: '',//1:在线问诊2:上门治疗
      },
      DiseaseOrderList: [],
      blackFlage: false,
      status: 'nomore',
    }
  },
  onLoad(options) {
    this.DiseaseOrderquery.category = options.category
    this.DiseaseOrderList = []
    this.DiseaseOrderquery.pageNumber = 1
    this._getDiseaseOrderList()
  },
  onReachBottom() {
    if (this.blackFlage) {
      return;
    }
    this.DiseaseOrderquery.pageNumber = this.DiseaseOrderquery.pageNumber + 1;
    this._getDiseaseOrderList()
  },
  methods: {
    // noreceive(orderNumber){
    // 	console.log(orderNumber)
    // 	uni.navigateTo({
    // 		url:'../treatment/edittreatment/edittreatment?orderNumber='+orderNumber
    // 	})
    // },
    gendertosex(val) {
      let name = ''
      switch (val) {
        case 1:
          name = '男'
          break;
        case 2:
          name = '女'
          break;
        case 3:
          name = '其他'
          break;
      }
      return name
    },
    _getDiseaseOrderList() {
      getDiseaseOrderList(this.DiseaseOrderquery).then(res => {
        if (res.data.records.length == 0 && this.DiseaseOrderquery.pageNumber != 1) {
          this.blackFlage = true
          return
        }
        this.DiseaseOrderList = this.DiseaseOrderList.concat(res.data.records)
      })
    }
  }
}
</script>

<style lang="scss">
.records-main {
  padding: 0 40rpx;

  .records-title {
    height: 108rpx;
    border-bottom: 2rpx solid #f7f7f7;

    .marginr6 {
      margin-right: 12rpx;
    }

    .colorC73 {
      color: #36bc73;
    }

    .colorE06 {
      color: #fc8e06;
    }
  }

  .records-con {
    padding-top: 20rpx;
    border-bottom: 2rpx solid #f7f7f7;

    >view {
      font-size: 28rpx;
      margin-bottom: 20rpx;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
    }
  }

  .recordbot {
    height: 92rpx;
  }

  .line {
    height: 20rpx;
    background-color: #f7f7f7;
  }
}
</style>